#include "../logs/log.hpp"

void test_log(const std::string& name)
{
    mylog::Logger::ptr logger = mylog::LoggerManager::GetInstance().getLogger(name);
    logger->info( "%s", "日志测试开始");

    logger->debug("%s", "日志测试");
    logger->info( "%s", "日志测试");
    logger->warn("%s", "日志测试");
    logger->error("%s", "日志测试");
    logger->fatal("%s", "日志测试");
    logger->info( "%s", "日志测试结束");

    
}
int main()
{
    std::unique_ptr<mylog::LoggerBuilder> loggerbuild(new mylog::GlobalLoggerBuilder());
    loggerbuild->buildLoggerName("async_logger");
    loggerbuild->buildLimitLevel(mylog::LogLevel::value::WARN);
    loggerbuild->buildLoggerType(mylog::LoggerType::LOGGER_ASYNC);
    loggerbuild->buildformater("[%d{%H:%M:%S}][%p]%T%m%n");
    loggerbuild->buildSinks<mylog::StdoutSink>();
    loggerbuild->buildSinks<mylog::FileSink>("./logfile/async.log");
    loggerbuild->buildSinks<mylog::RollBySizeSink>("./logfile/roll-async-by-size", 1024);
    //loggerbuild->buildEnableUnSafeAsync();这条主要用于性能测试
    loggerbuild->build();
    test_log("async_logger");
    return 0;
}